<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'mortgage.label', default: 'Mortgage')}"/>
    <title>预警待办</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    @media screen and (min-width:1900px) and (max-width:1920px) {
        .flex{
            display: flex;justify-content: center;align-items: center;
        }
    }
    .select2-container .select2-choices .select2-search-field input,.select2-container .select2-choice,.select2-container .select2-choices{

        color: #999;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>
                        <span>CINDTATA PLS</span>
                    </li>
                    <li>
                        <span>预警待办</span>
                    </li>
                </ol>
            </div>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="riskWarningPending" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" onclick=""><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i> 重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group" id="bug1">

                    <input type="hidden" name="flag" value="${this.params?.flag}">
                    <input type="hidden" name="status" value="${this.params?.status}">

                    <div class="row ">

                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">预警编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="serialNumber" id="serialNumber" value="${params?.serialNumber}" placeholder="请输入预警编号">
                            </div>
                        </div>
                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">预警种类</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="sourceClassType" id="sourceClassType" from="${com.cindata.RiskWarningConfig.constrainedProperties.sourceClassType.inList}"
                                value="${params?.sourceClassType}" noSelection="${['': '请选择预警种类']}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">工作流</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="workflow" id="workflow"
                                  from="${com.cindata.Workflow.findAllByType(com.cindata.dictionary.WorkflowType.findByName('预警'))}"
                                  valueMessagePrefix="status" optionKey="id" optionValue="name"
                                  value="${params?.workflow}"
                                  noSelection="${['': '请选择工作流']}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">预警类型</label>
                            <div class="col-sm-9">
                                <g:select class="form-control m-b" name="warningType" id="warningType" from="${com.cindata.dictionary.RiskWarningTypeDict.list()}" optionValue="name" optionKey="id" value="${params?.warningType}" noSelection="${['': '请选择预警类型']}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                &nbsp;&nbsp;
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="serialNumber" title="预警编号" params="${params}"/>
                            <g:sortableColumn property="sourceClassType" title="种类" params="${params}"/>
                            <g:sortableColumn property="type" title="类型" params="${params}"/>
                            <g:sortableColumn property="workflowName" title="工作流名称" params="${params}"/>
                            <g:sortableColumn property="workflow" title="工作流" params="${params}"/>
                            <g:sortableColumn property="name" title="当前阶段" params="${params}"/>
                            <g:sortableColumn property="city" title="当前状态" params="${params}"/>
                            <g:sortableColumn property="district" title="创建时间" params="${params}"/>
                            <g:sortableColumn property="fullName" title="修改时间" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${workflowInstanceUserList}">
                            <tr>
                                <td>
                                    <g:if test="${it[7]?.sourceClassType == '押品'}">
                                        <g:link style="color: #3498DB" controller="riskWarning" action="riskWarningCollateralShow" class="firstTd" id="${it[0]}">${it[1]}</g:link>
                                    </g:if>
                                    <g:elseif test="${it[7]?.sourceClassType == '贷款'}">
                                        <g:link style="color: #3498DB" controller="riskWarning" action="riskWarningMortgageShow" class="firstTd" id="${it[0]}">${it[1]}</g:link>
                                    </g:elseif>
                                    <g:elseif test="${it[7]?.sourceClassType == '借款人'}">
                                        <g:link style="color: #3498DB" controller="riskWarning" action="riskWarningContactShow" class="firstTd" id="${it[0]}">${it[1]}</g:link>
                                    </g:elseif>
                                    <g:elseif test="${it[7]?.sourceClassType == '小区'}">
                                        <g:link style="color: #3498DB" controller="riskWarning" action="riskWarningCommunityShow" class="firstTd" id="${it[0]}">${it[1]}</g:link>
                                    </g:elseif>
                                    <g:elseif test="${it[7]?.sourceClassType == '机构'}">
                                        <g:link style="color: #3498DB" controller="riskWarning" action="riskWarningAccountShow" class="firstTd" id="${it[0]}">${it[1]}</g:link>
                                    </g:elseif>
                                </td>
                                <td>${it[7]?.sourceClassType}</td>
                                <td>${it[7]?.type?.name}</td>
                                <td>${it[2]}</td>
                                <td>${it[7]?.workflow?.name}</td>
                                <td>${it[3]}</td>
                                <td>${it[4]}</td>
                                <td><g:formatDate date="${it[5]}" format="yyyy-MM-dd HH:mm:ss" ></g:formatDate></td>
                                <td><g:formatDate date="${it[6]}" format="yyyy-MM-dd HH:mm:ss" ></g:formatDate></td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate action="riskWarningPending" total="${count ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    
    $("#resetBtn").click(function () {
        $("#serialNumber").val("");
        $("#s2id_sourceClassType span:first").html("请选择预警种类");
        $("#sourceClassType").val("");
        $("#s2id_workflow span:first").html("请选择工作流");
        $("#workflow").val("");
        $("#s2id_warningType span:first").html("请选择预警类型");
        $("#warningType").val("");
    });

</script>
</body>
</html>
